package com.wandong.cinema.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class IdGenerator {
    private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyyMMddHHmmss");
    private static final Random RANDOM = new Random();

    // 生成用户ID
    public static String generateUserId(String userType) {
        return userType + "-" + SDF.format(new Date()) + "-" + (1000 + RANDOM.nextInt(9000));
    }

    // 生成影片ID
    public static String generateMovieId() {
        return "MOV-" + SDF.format(new Date()) + "-" + (1000 + RANDOM.nextInt(9000));
    }

    // 生成放映厅ID
    public static String generateHallId() {
        return "H" + String.format("%03d", RANDOM.nextInt(1000));
    }

    // 生成场次ID
    public static String generateShowId() {
        return "SHOW-" + SDF.format(new Date()) + "-" + (1000 + RANDOM.nextInt(9000));
    }

    // 生成票号
    public static String generateTicketId() {
        return "TICKET-" + SDF.format(new Date()) + "-" + (100000 + RANDOM.nextInt(900000));
    }

    // 生成全局唯一ID
    public static String generateGUID() {
        return "GUID-" + SDF.format(new Date()) + "-" + (10000000 + RANDOM.nextInt(90000000));
    }
}
